<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /**
         * 数据类型
         */ 
        var a = 5
        var b = 'hello'
        var c = true 
        var d = null 
        var e 
        var f = new Date()
        var g = new Array()

        // console.log(typeof a)
        // console.log(typeof b)
        // console.log(typeof c)
        // console.log(typeof d)
        // console.log(typeof e) // undefined
        // console.log(typeof f)
        // console.log(typeof g) // 如果数据为null、Date、Array等，返回的都是object

        /**
         * 类型转换
         */
        // 转换为数值
        console.log('25')
        console.log(Number('25abc'))
        console.log(parseInt('25abc78'))
        console.log(parseFloat('25.7'))
        console.log(parseInt('25.7'))

        // 转换为字符串
        console.log('' + 25 + 6)

        // 转换为布尔
        console.log(Boolean(0))
        console.log(Boolean(''))
        console.log(Boolean(null))
        console.log(Boolean(e))

    </script>
</head>
<body>
    
</body>
</html>